package com.gz.utils;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

import com.gz.pojo.Animal;

public class FullBeanUtils {

	public static Animal full(String className, HttpServletRequest request) {

		Animal o = null;
		try {
			Class c = Class.forName(className);
			o = (Animal) c.newInstance();
			Field[] fArr = c.getDeclaredFields();
			for (Field f : fArr) {
				f.setAccessible(true);
				f.set(o, request.getParameter(f.getName()));
				f.setAccessible(false);
			}
		} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
			e.printStackTrace();
		}

		return o;
	}
}
